package org.cid54.bukkit;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Dispenser;
import org.bukkit.entity.Arrow;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;

/**
 *
 * @author Cid54
 */
public class Cid54BlockListener extends BlockListener {

    @Override
    public void onBlockDispense(BlockDispenseEvent event) {
        super.onBlockDispense(event);

        if (event.getItem().getType().equals(Material.ARROW) || event.getItem().getType().equals(Material.SNOW_BALL) || event.getItem().getType().equals(Material.EGG)) {
            if (event.getBlock().getState() instanceof Dispenser) {
                Dispenser d = (Dispenser) event.getBlock().getState();
                d.getInventory().addItem(new ItemStack(event.getItem().getType(), 1));

                

            }
        }
    }
}
